using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication11.Models.Mapping
{
    public class diet_menu_foodMap : EntityTypeConfiguration<diet_menu_food>
    {
        public diet_menu_foodMap()
        {
            // Primary Key
            this.HasKey(t => t.diet_menu_food_id);

            // Properties
            this.Property(t => t.food_name)
                .HasMaxLength(50);

            this.Property(t => t.food_component)
                .HasMaxLength(200);

            // Table & Column Mappings
            this.ToTable("diet_menu_food");
            this.Property(t => t.diet_menu_food_id).HasColumnName("diet_menu_food_id");
            this.Property(t => t.food_name).HasColumnName("food_name");
            this.Property(t => t.food_num).HasColumnName("food_num");
            this.Property(t => t.food_component).HasColumnName("food_component");
            this.Property(t => t.diet_menu_list_id).HasColumnName("diet_menu_list_id");

            // Relationships
            this.HasOptional(t => t.diet_menu_list)
                .WithMany(t => t.diet_menu_food)
                .HasForeignKey(d => d.diet_menu_list_id);

        }
    }
}
